﻿namespace DeltaGroup.WheelOfJeopardy.ChallengeManager
{
    using System.Collections.Generic;

    public static class StopWords
    {
        #region Fields

        public const string STOPWORD_SEARCH_PATTERN = @"(^|\W){0}(\W|$)";

        static StopWords()
        {
            object lockcheck1 = new object();
            if (baseList == null)
            {
                lock (lockcheck1)
                {
                    if (baseList == null)
                    {
                        baseList = new List<string>(baseWords);
                    }
                }
            }

            object lockcheck2 = new object();
            if (moderateList == null)
            {
                lock (lockcheck2)
                {
                    if (moderateList == null)
                    {
                        moderateList = new List<string>(baseWords);
                        moderateList.AddRange(moderateWords);
                    }
                }
            }

            object lockcheck3 = new object();
            if (relaxedList == null)
            {
                lock (lockcheck3)
                {
                    if (relaxedList == null)
                    {
                        relaxedList = new List<string>(baseWords);
                        relaxedList.AddRange(moderateWords);
                        relaxedList.AddRange(relaxedWords);
                    }
                }
            }
        }

        private static List<string> baseList;
        private static List<string> moderateList;
        private static List<string> relaxedList;

        private static readonly string[] baseWords = new string[] { "a", "am", "an", "and", "as", "at",
                "be", "been", "but", "by", "co", "do", "for", "get", "i", "ie", "if", "in", "inc", "is", "it", "its", "me", 
                "of", "onto", "or", "so", "than", "that", "the", "then", "this", "to", "too", 
                "was", "we", "well", "were" };

        private static readonly string[] moderateWords = new string[] { "how", 
                "were", "what", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby",
                "wherein", "whereupon", "wherever", "whether", "which", "whither", "who", "whoever", "whom", "whose", "why",
                "will", "would"};

        private static readonly string[] relaxedWords = new string[] { "about", "above", "across", "afterwards", "again", "against", "all", 
                "almost", "alone", "along", "already", "although", "among", "amongst", "amoungst", "amount",
                "another", "any", "anyhow", "anyone", "anything", "anyway", "anywhere", "around",
                "became", "because", "become", "becomes", "becoming", "been", "beforehand", "being", "besides", "beyond",
                "call", "computer", "con", "cry", "de", "describe", "detail", "done", "due", "during",
                "each", "either", "else", "elsewhere", "empty", "enough", "etc", "even", "ever", "every",
                "everyone", "everything", "everywhere", "except", "few", "fill", "find", "fire", "former", "formerly", "found",
                "from", "front", "full", "further","get", "give", 
                "had", "has", "hasnt", "have", "he", "hence", "her", "here", "hereafter", "hereby", "herein", "hereupon", "hers", "herse", "him", "himse", "his", "how", "however", "hundred",
                "indeed", "interest", "into", "itse", "keep", "last", "latter", "latterly", "least", "less", "ltd",
                "made", "many", "may", "meanwhile", "might", "mill", "mine", "more", "moreover", "most", "mostly", "move", "much", "must", "my", "myse",
                "name", "namely", "neither", "never", "nevertheless", "next", "no", "nobody", "none", "noone", "nor", "not", "nothing", "now", "nowhere",
                "often", "once", "one", "only", "other", "others", "otherwise", "our", "ours", "ourselves", "out", "over", "own",
                "part", "per", "perhaps", "please", "put", "rather", "re",
                "same", "see", "seem", "seemed", "seeming", "seems", "serious", "several", "she", "should", "show", "side", "since", "sincere", 
                "some", "somehow", "someone", "something", "sometime", "sometimes", "somewhere", "still", "such", "system",
                "take", "their", "them", "themselves", "thence", "there", "thereafter", "thereby", "therefore",
                "therein", "thereupon", "these", "they", "those", "though", "through", "throughout",
                "thru", "thus", "together", "toward", "towards", "un", "under", "until", "upon", "us", "very", "via",
                "whole", "with", "within", "would", "yet", "you", "your", "yours", "yourself", "yourselves" };

        #endregion Fields

        #region Properties

        /// <summary>
        /// Gets the word list.
        /// </summary>
        /// <value>The word list.</value>
        public static List<string> BaseWordList
        {
            get { return baseList; }
        }

        public static List<string> ModerateWordList
        {
            get { return moderateList; }
        }

        public static List<string> RelaxedWordList
        {
            get { return relaxedList; }
        }

        #endregion Properties
    }
}